﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smartec.Accounts.Camel.AMS.Model.Entities;

namespace Smartec.Accounts.Camel.AMS.Model.Repository
{
//    class DBAuditRepository
//    {
//    }
//}
    internal static class PartnersRepository
    {

        internal static void AddPartner(Partners partner)
        {
            AMSObjectContextHelper.CurrentObjectContext.Partners.AddObject(partner);
        }
        internal static void Save()
        {
            AMSObjectContextHelper.CurrentObjectContext.SaveChanges();
        }

        internal static List<Partners> All()
        {
          return  AMSObjectContextHelper.CurrentObjectContext.Partners.ToList();
        }

        internal static void DeletePartnerById(int id)
        {
            var partner = AMSObjectContextHelper.CurrentObjectContext.Partners.FirstOrDefault(t => t.ID == id);
            if (partner != null)
            {
                AMSObjectContextHelper.CurrentObjectContext.Partners.DeleteObject(partner);
            }
        }
    }
}
